<?php


class Cuser
{
	var $id;
	var	$username;
	var $usernamelink;
  
  function Cuser($id)
  {
	$me = array();
	$si = array();
	$tk = array();
	include("inc/joomlaInt.php");
	include("inc/inc_configuration.php");
    $this->id=$id;
	$id=$this->id;
	$q = "SELECT * FROM $tbl_users WHERE id=$id";
	$qe = mysql_query($q);
	$qeo = mysql_fetch_object($qe);
	
	$this->username=$qeo->username;
	
	$q = "	SELECT 
				e.bezeichnung,
				l.name
			FROM
				$tbl_erfolge e,
				$tbl_combinations c,
				$tbl_leagues l
			WHERE
				e.combinationId=c.id AND
				e.leagueId=l.id AND
				c.userId=$id";
	$qe = mysql_query($q);
	
	$erf = "";
	
	$path = "img/awards/";
	$img = "";
	
	while ($row=mysql_fetch_object($qe))
	{
		$bez = $row->bezeichnung;
		
		if ($bez == "Meister")
		{
			$liga = $row->name;
			if ($liga == "1. Bundesliga")
			{
				$me[] = "<img src='$path" . "me.png" . "' alt='(M)' align='top' title='Meister 1.Bundesliga'>";
			}
			else
				{
					if ($liga == "Primera División")
					{
						$me[] = "<img src='$path" . "me.png" . "' alt='(M)' align='top' title='Meister Primera División'>";
					}
				}
		}
		else
			{
				if ($bez == "Sieger")
				{
					$liga = $row->name;
					if ($liga == "DFB Pokal")
					{
						$si[] = "<img src='$path" . "si.png" . "' alt='(P)' align='top' title='DFB Pokal Sieger'>";
					}
					else
					{
						if ($liga == "FIFA House Cup")
						{
							$si[] = "<img src='$path" . "si.png" . "' alt='(C)' align='top' title='House Cup Sieger'>";
						}
						else
							if ($liga == "House EM")
							{
								$si[] = "<img src='$path" . "si.png" . "' alt='(C)' align='top' title='House EM Sieger'>";
							}
					}
				}
				else
					{
						if ($bez == "Torschützenkönig")
						{
							$liga = $row->name;
							
							if ($liga == "Primera División")
							{
								$tk[] = "<img src='$path" . "tk.png" . "' alt='(TK)' align='top' title='Torschützenkönig Primera División'>";
							}
							else
							{
								if ($liga == "1. Bundesliga")
								{
									$tk[] = "<img src='$path" . "tk.png" . "' alt='(TK)' align='top' title='Torschützenkönig 1. Bundesliga'>";
								}
								else
								{
									if ($liga == "DFB Pokal")
									{
										$tk[] = "<img src='$path" . "tk.png" . "' alt='(TK)' align='top' title='Torschützenkönig DFB Pokal'>";
									}
									else
									{
										if ($liga == "FIFA House Cup")
										{
											$tk[] = "<img src='$path" . "tk.png" . "' alt='(TK)' align='top' title='Torschützenkönig House Cup'>";
										}
										else
											if ($liga == "House EM")
											{
												$tk[] = "<img src='$path" . "tk.png" . "' alt='(TK)' align='top' title='Torschützenkönig House EM'>";
											}
									}
								}
							}
							
						}
					}
			}
	}
	
	$i=0;
	
	while ($i<count($me))
	{
		$erf.=$me[$i];
		$i++;
	}
	
	$i=0;
	
	while ($i<count($si))
	{
		$erf.=$si[$i];
		$i++;
	}
	
	$i=0;
	
	while ($i<count($tk))
	{
		$erf.=$tk[$i];
		$i++;
	}
	
	$this->username .= $erf;
	
	$url = "<a href='profil.php?id=$id'>" . $this->username . "</a>";
	
	$this->usernamelink=$url;
  }
  
  

 }



?>